//
//  PdfMainAgreementView.m
#import "PdfMainAgreementView.h"
@interface PdfMainAgreementView()
@property (nonatomic,strong) UIImageView *pdfUserHeadImgView;
@property (nonatomic,strong) UILabel *pdfMainUserHeadLab;
@property (nonatomic,strong) UIImageView *pdfUserHeadGoImgView;

@property (nonatomic,strong) UILabel *pdfMainVipTitleLab;
@property (nonatomic,strong) UIButton *pdfMainOpenVipBtn;
@end
@implementation PdfMainAgreementView
-(instancetype)init{
    if (self == [super init]) {
        [self pdfInitView];
    }
    return self;
}
- (void)pdfInitView{
    UIImageView * pdfUserHeadImgView = [[UIImageView alloc] init];
    pdfUserHeadImgView.userInteractionEnabled = true;
    pdfUserHeadImgView.image = PdfImageNamed(@"pdfHeadUserAgreemnet");
    [self addSubview:pdfUserHeadImgView];
    [pdfUserHeadImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(PdfRatio(30)));
        make.top.equalTo(@(PdfRatio(32)));
        make.width.equalTo(@(PdfRatio(40)));
        make.height.equalTo(@(PdfRatio(40)));
    }];
    UILabel * pdfMainUserHeadLab = [[UILabel alloc] init];
    pdfMainUserHeadLab.textColor = PdfHex(@"#222222");
    pdfMainUserHeadLab.font = [UIFont systemFontOfSize:PdfRatio(28) weight:UIFontWeightRegular];
    pdfMainUserHeadLab.text = @"用户协议";
    [self addSubview:pdfMainUserHeadLab];
    [pdfMainUserHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(pdfUserHeadImgView.mas_right).offset(PdfRatio(22));
        make.centerY.equalTo(pdfUserHeadImgView);
        make.height.equalTo(@(PdfRatio(39)));
    }];
    UIImageView * pdfUserHeadGoImgView = [[UIImageView alloc] init];
    pdfUserHeadGoImgView.userInteractionEnabled = true;
    pdfUserHeadGoImgView.image = PdfImageNamed(@"pdfAgreentGo");
    [self addSubview:pdfUserHeadGoImgView];
    [pdfUserHeadGoImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(pdfMainUserHeadLab);
        make.right.equalTo(@(-PdfRatio(32)));
        make.width.equalTo(@(PdfRatio(10)));
        make.height.equalTo(@(PdfRatio(18)));
    }];
    UIButton * pdfUserHeadGoBtn = [[UIButton alloc] init];
    [pdfUserHeadGoBtn addTarget:self action:@selector(pdfUserHeadGo) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:pdfUserHeadGoBtn];
    [pdfUserHeadGoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(PdfRatio(0)));
        make.right.equalTo(@(PdfRatio(0)));
        make.top.equalTo(@(PdfRatio(0)));
        make.height.equalTo(@(PdfRatio(104)));
    }];
    
    UIImageView * pdfPriHeadImgView = [[UIImageView alloc] init];
    pdfPriHeadImgView.userInteractionEnabled = true;
    pdfPriHeadImgView.image = PdfImageNamed(@"pdfHeadPriAgreemnet");
    [self addSubview:pdfPriHeadImgView];
    [pdfPriHeadImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(PdfRatio(30)));
        make.top.equalTo(pdfUserHeadImgView.mas_bottom).offset(PdfRatio(64));
        make.width.equalTo(@(PdfRatio(40)));
        make.height.equalTo(@(PdfRatio(40)));
    }];
    UILabel * pdfMainPriHeadLab = [[UILabel alloc] init];
    pdfMainPriHeadLab.textColor = PdfHex(@"#222222");
    pdfMainPriHeadLab.font = [UIFont systemFontOfSize:PdfRatio(28) weight:UIFontWeightRegular];
    pdfMainPriHeadLab.text = @"隐私协议";
    [self addSubview:pdfMainPriHeadLab];
    [pdfMainPriHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(pdfPriHeadImgView.mas_right).offset(PdfRatio(22));
        make.centerY.equalTo(pdfPriHeadImgView);
        make.height.equalTo(@(PdfRatio(39)));
    }];
    UIImageView * pdfPriHeadGoImgView = [[UIImageView alloc] init];
    pdfPriHeadGoImgView.userInteractionEnabled = true;
    pdfPriHeadGoImgView.image = PdfImageNamed(@"pdfAgreentGo");
    [self addSubview:pdfPriHeadGoImgView];
    [pdfPriHeadGoImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(pdfMainPriHeadLab);
        make.right.equalTo(@(-PdfRatio(32)));
        make.width.equalTo(@(PdfRatio(10)));
        make.height.equalTo(@(PdfRatio(18)));
    }];
    UIButton * pdfPriHeadGoBtn = [[UIButton alloc] init];
    [pdfPriHeadGoBtn addTarget:self action:@selector(pdfPriHeadGo) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:pdfPriHeadGoBtn];
    [pdfPriHeadGoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(PdfRatio(0)));
        make.right.equalTo(@(PdfRatio(0)));
        make.top.equalTo(pdfUserHeadGoBtn.mas_bottom);
        make.height.equalTo(@(PdfRatio(104)));
    }];
}
- (void)pdfUserHeadGo{
    if(self.PdfMainUserBlock){
        self.PdfMainUserBlock();
    }
}
- (void)pdfPriHeadGo{
    if(self.PdfMainPriBlock){
        self.PdfMainPriBlock();
    }
}
@end
